package com.qcby.onlinelearningplatform.Common;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultCommon {

    private long code;

    private String message;

    private Object obj;

    /**
     * 成功返回结果
     *
     * @param message 消息Ob
     * @return {@link ResultCommon}
     */
    public static ResultCommon success(String message){
        return new ResultCommon(200,message,null);
    }

    /**
     * 成功返回结果(带对象)
     *
     * @param message 消息
     * @return {@link ResultCommon}
     */
    public static ResultCommon success(String message,Object obj){
        return new ResultCommon(200,message,obj);
    }

    /**
     * 失败返回结果
     *
     * @param message 消息
     * @return {@link ResultCommon}
     */
    public static ResultCommon error(String message){
        return new ResultCommon(999,message,null);
    }

    public static ResultCommon error(String message,Object obj){
        return new ResultCommon(999,message,obj);
    }

}
